package com.xdb.sqlparser.dialect.oracle.ast.expr;

import com.xdb.sqlparser.ast.SQLExpr;
import com.xdb.sqlparser.ast.AbstractSQLExprImpl;
import com.xdb.sqlparser.dialect.oracle.visitor.OracleASTVisitor;
import com.xdb.sqlparser.visitor.SQLAstVisitor;

public class OracleIsSetExpr extends AbstractSQLExprImpl implements OracleExpr {

	private SQLExpr nestedTable;

	public OracleIsSetExpr() {
	}

	public OracleIsSetExpr(SQLExpr nestedTable) {
		this.nestedTable = nestedTable;
	}

	public SQLExpr getNestedTable() {
		return nestedTable;
	}

	public void setNestedTable(SQLExpr nestedTable) {
		this.nestedTable = nestedTable;
	}

	@Override
	protected void accept0(SQLAstVisitor visitor) {
		this.accept0((OracleASTVisitor) visitor);
	}

	@Override
	public void accept0(OracleASTVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, nestedTable);
		}
		visitor.endVisit(this);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((nestedTable == null) ? 0 : nestedTable.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		OracleIsSetExpr other = (OracleIsSetExpr) obj;
		if (nestedTable == null) {
			if (other.nestedTable != null) {
				return false;
			}
		} else if (!nestedTable.equals(other.nestedTable)) {
			return false;
		}
		return true;
	}

}
